<?php
require 'config.php';
$user_id = $_REQUEST['user_id'];
$user_name = $_REQUEST['user_name'];
$user_mobile = $_REQUEST['user_mobile'];
$address = $_REQUEST['address'];
$number = $_REQUEST['number'];
$lat = $_REQUEST['lat'];
$lng = $_REQUEST['lng'];
$address_id = $_REQUEST['address_id'];
$time = date('Y-m-d H:i:s');
// $sql="select * from `".$oto."_user_address` where `userId`='".$user_id."'";
// $result=$db->query($sql);
// while($row=$result->fetch_assoc()){
//     $user_address[]=$row;//将取得的所有数据赋值给person_info数组
// }
$sql = "UPDATE `" . $oto . "_user_address` SET  `userName`='{$user_name}', `userPhone`='{$user_mobile}', `userTel`=NULL, `areaId1`='0', `areaId2`='0', `areaId3`='0', `communityId`='0', `address`='{$address}', `postCode`=NULL, `addressFlag`='1', `sex`='0', `lng`='{$lng}', `lat`='${lat}', `number`='{$number}' WHERE (`addressId`='{$address_id}' AND userId = {$user_id} );";
// $sql = "update " . $oto . "_user_address set userName='{$user_name}',userPhone='{$user_mobile}',areaId1='{$address1}',areaId2='{$address2}',areaId3='{$address3}',communityId='0',address='{$jiedao}' where userId='{$user_id}' and addressId='{$address_id}'";
$result = $db->query($sql);
if ($result) {
    $data[0]['pan'] = 1;
} else {
    $data[0]['pan'] = 0;
}
echo json_encode($data);
